function pro (method,data){
    return new Promise((resolve,reject)=>{
        //模拟耗时操作
        setTimeout(()=>{
            console.log(method,data)
            resolve(data+1)
        },100)
    })
}

//promise
pro('promise',1).then((value)=>pro('promise',value)).then((value)=>pro('promise',value))

//async
async function asy(){
    const first = await pro('async',1)
    const second = await pro('async',first)
    pro('async',second)
}
asy()

//generator
function *Gen() {
	yield setTimeout(()=>{!console.log('generator',1)&&simpleGen.next()},100)
	yield setTimeout(()=>{!console.log('generator',2)&&simpleGen.next()},100)
	return setTimeout(()=>{console.log('generator',3)},100)
}
const simpleGen = Gen()
simpleGen.next()



